<template>
	<view class="page-box">
		<!-- content -->
		<view class="content">
			<block v-for="(item,index) in datailList" :key="item.id">
				<view class="content-box" @click="goActivity(item.id)">
					<view class="content-img">
						<image :src="item.image" mode="aspectFill" class="activity_img"></image>
					</view>
					<view class="content-middle">
						<view class="content-title">{{item.title}}</view>
						<view class="content-btn">立即参与</view>
					</view>
					<view class="content-price"><text>￥</text>{{item.price}}</view>
				</view>
			</block>
		</view>
		<view class="foot_box"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				datailList: [],
				isShow: false,
				onceData: []
			}
		},
		onLoad() {
			this.getDetailList()
		},
		onShow() {
			if (this.isShow) {
				this.datailList = [...this.onceData]
			}
		},
		methods: {
			goActivity(id) {
				uni.navigateTo({
					url: `route-detail?id=${id}`
				})
			},
			getDetailList() {
				this.$apiBase('detailList', null).then(res => {
					this.datailList = res.data.data;

				})
			}

		}
	}
</script>

<style lang="scss">
	.page-box {
		width: 100vw;
		height: 100vh;
		background-color: #F8F7FC;

		.content {
			display: flex;
			flex-direction: column;

			.content-box {
				margin: 36rpx 30rpx 0rpx 30rpx;

				.content-img {
					width: 100%;
					height: 390rpx;

					.activity_img {
						width: 100%;
						height: 100%;
						border-radius: 14rpx;
						object-fit: cover;
					}

				}

				.content-middle {
					display: flex;
					justify-content: space-between;
					padding-top: 30rpx;

					.content-title {
						font-size: 28rpx;
						font-weight: 500;
						color: #000000;
					}

					.content-btn {
						width: 138rpx;
						height: 52rpx;
						background: #F2A12D;
						font-size: 26rpx;
						font-weight: 500;
						color: #FFFFFF;
						line-height: 52rpx;
						text-align: center;
						border-radius: 10rpx;
					}
				}

				.content-price {
					font-size: 30rpx;
					font-weight: bold;
					color: #F31717;

					text {
						font-size: 22rpx;
					}
				}

			}
		}

		.foot_box {
			height: 1rpx;
			margin-top: 42rpx;
		}
	}
</style>
